﻿@page
@model FastEtlWeb.Pages.DicFormModel
@{
    Layout = null;
}
<html>
<head>
    @await Html.PartialAsync("Meta")
    @await Html.PartialAsync("link")
    @await Html.PartialAsync("script")
    <link href="/content/css/Form.css" rel="stylesheet" type="text/css" />
</head>
<body class="form-body">
    <form id="submitForm" style="margin-top:-10px;">
        @Html.HiddenFor(a => Model.info.Id)
        <div class="input-group">
            <div class="input-group-addon input-group-none"><label>类型</label></div>
            @Html.DropDownListForDic(a => a.info.DicId, new { @class = "form-control" }, Model.info.DicId)
        </div>
        <div class="input-group">
            <div class="input-group-addon input-group-none"><label>名称</label></div>
            @Html.TextBoxFor(a => a.info.Name, new { @class = "form-control", @autocomplete = "off" })
        </div>
        <div class="input-group">
            <div class="input-group-addon input-group-none"><label>值</label></div>
            @Html.TextBoxFor(a => a.info.Value, new { @class = "form-control", @autocomplete = "off" })
        </div>
        <div class="input-group">
            <div class="input-group-addon input-group-none"><label>对照值</label></div>
            @Html.TextBoxFor(a => a.info.ContrastValue, new { @class = "form-control", @autocomplete = "off" })
        </div>
    </form>
    <div class="center">
        <button type="button" class="btn btn-primary center" id="FormBtn">确定</button>
        <button type="button" class="btn btn-primary center" id="CloseBtn">关闭</button>
    </div>
</body>
</html>
<script>
    $("#CloseBtn").click(function () {
         var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    });

     $("#FormBtn").click(function () {
        parent.layer.load(2);
        var reg = new RegExp("info.", "g");
        $.ajax({
            type: "post",
            url: "DicForm?handler=DicForm",
            data: $("#submitForm").serialize().replace(reg, ""),
            success: function (result) {
                parent.layer.closeAll('loading');
                parent.layer.msg(result.msg);

                if (result.success)
                    $("#CloseBtn").click();
            }
        });
    });
</script>